<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('userfield_list'); 
//模型标识
if(!empty($cid))
{
	$r = $dosql->GetOne("SELECT * FROM `#@__usermodel` WHERE `id`='$cid'");
	if(empty($r) && !is_array($r))
	{
		echo '<script>history.go(-1);</script>';
		exit();
	}
}
else
{
	echo '<script>history.go(-1);</script>';
	exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title><?php echo $r['modeltitle'];?>扩展字段 </title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<link href="templates/css/pagination.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/layindex.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" src="templates/js/forms.func.js"></script>
<script type="text/javascript">
	function getVal(id)
	{
				$.ajax({
					url : "ajax_do.php",
					type:'post',
					data:{"action":"userfieldorderid", "orderid":document.getElementById(id).value,"pid":document.getElementsByName(id)[0].getAttribute("pid")},
					dataType:'html',
					success:function(data){	
					}
				});		
	}
	
	function func(id){
	//获取被选中的option标签
		var vs = $('#'+id+' option:selected').val();
		if(vs>=0){
		location.href = "userfield.php?cid="+vs;}
		else{
			
			location.href = "userfield.php";
		}
	}

	
</script>
</head>

<body class="mainbody">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i><span><?php echo $r['modeltitle'];?>模型</span>  <i class="arrow"></i><span>扩展字段管理</span>
  <a href="javascript:location.reload();" class="reload">刷新</a>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"></a>
      <div class="l-list">
        <ul class="icon-list">
          <li><a class="add" href="userfield_add.php?tbnames=<?php echo $r['modeltbname'];?>"><i></i><span>添加新字段</span></a></li>
        </ul>
		
      
    </div>
  </div>
</div>
<!--/工具栏-->
<form name="form" id="form" method="post" action="userfield_save.php">
<!--列表-->
<div class="table-container">
  
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
 	<tr align="center" >
      <th width="8%">ID</th>
      <th  width="15%">字段名称</th>
      <th width="12%" >标识</th>
      <th width="12%" >类型</th>
      <th width="5%" >注册</th>
      <th width="5%" >前台</th>
      <th width="8%">排序</th>
      <th >状态</th>
      <th width="8%">操作</th>
    </tr>
<?php
		$sql = "SELECT * FROM `#@__userfield` where infotype=$cid";
		$dopage->GetPage($sql,'15','ASC','orderid');
		while($row = $dosql->GetArray())
		{
			switch($row['checkinfo'])
			{
				case 'true':
					$checkinfo = '启用';
					break;  
				case 'false':
					$checkinfo = '禁用';
					break;
				default:
					$checkinfo = '没有获取到参数';
			}
		?>
		<tr align="center" >
			<td ><?php echo $row['id']; ?></td>
			<td><?php echo $row['fieldname']; ?></td>
			<td><?php echo $row['fieldtitle']; ?></td>
			<td><?php echo $row['fieldtype']; ?></td>
			<td ><?php if($row['isreg']=='true') echo '<font color="blue">√</font>';else echo'<font color="red">×</font>'?></td>
			<td ><?php if($row['isadd']=='true') echo '<font color="blue">√</font>';else echo'<font color=" red">×</font>'?></td>
		<td width="10%" align="center">
		<input type="text" name="orderid[<?php echo $row['id']; ?>]" pid="<?php echo $row['id']; ?>" id="orderid[<?php echo $row['id']; ?>]" class="sort" onblur="getVal(this.id)" value="<?php echo $row['orderid']; ?>" />
		</td>
			<td width="10%"><span><a href="userfield_save.php?action=check&id=<?php echo $row['id']; ?>&infotype=<?php echo $row['infotype']; ?>&checkinfo=<?php echo $row['checkinfo']; ?>" title="点击进行审核与未审操作"><?php echo $checkinfo; ?></a></span></td>
		
		<td width="12%"align="center" > <span><a href="userfield_update.php?id=<?php echo $row['id']; ?>">修改</a></span> | <span class="nb"><a href="userfield_save.php?action=del&infotype=<?php echo $row['infotype']; ?>&id=<?php echo $row['id']; ?>&fieldname=<?php echo $row['fieldname']; ?>&tbnames=<?php echo $r['modeltbname'];?>" onclick="return ConfDel(0)">删除</a></span></td>		</tr>
		<?php
		}
		?>

  </table>
  
</div>
<!--/列表-->

<!--内容底部-->
<div class="line20"></div>
<div class="pagelist"  >
 
  <?php echo $dopage->GetList($sql); ?>

</div>
<!--/内容底部-->
</form>
</body>
</html>
